<?php
namespace Ygcl\Controller;
use Admin\Controller\AdminbaseController;
class ApiadminController extends AdminbaseController {
	
	protected $m;
	protected $dService;
	
	function _initialize() {
		parent::_initialize();
	}
	
    //获取校区权限
    public function getxiaoqurole(){
    	if(strpos($_SESSION['curUserRole']['title'],'XIAOQU_ADMIN')  || strpos($_SESSION['curUserRole']['title'],'XIAOWU_ADMIN')){
    		$data =  $_SESSION['curUserRole']['xiaoqu'];
    	}else{
    		$data = false;
    	}
    	
    	return $data;
    }
    
    //校区、课程、班级、学期排序
    public function changelistorder(){
    	$type = $_POST['type'];
    	if($type == 'lesson'){
    		$m = M('YgclLesson');
    	}
    	if($type == 'district'){
    		$m = M('YgclDistrict');
    	}
    	if($type == 'class'){
    		$m = M('YgclClass');
    	}
    	if($type == 'term'){
    		$m = M('YgclTerm');
    	}
    	$data = array(
    		'id' => $_POST['id'],
    		'listorder' => $_POST['listorder']
    	);
    	if($m->save($data)){
    		$this->success('修改成功');
    	}else{
    		$this->error('修改失败');
    	}
    }
}